import java.util.Arrays;
import java.util.Scanner;

public class Demo2 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] array = new int[n];

        for(int i = 0; i < n; i++) {
            array[i] = scan.nextInt();
        }

        Arrays.sort(array);
        System.out.println(func(array,n,0,0,1));
    }

    public static int func(int[] array,int n,int pos,int sum,int ruselt) {

        int count = 0;

        for(int i = pos; i < n; i++) {
            sum += array[i];
            ruselt *= array[i];
            if(sum > ruselt) {
                count = count + 1 + func(array,n,i+1,sum,ruselt);
            }else if(array[i] == 1) {
                count = count +func(array,n,i+1,sum,ruselt);
            }else {
                break;
            }

            sum = sum - array[i];
            ruselt = ruselt / array[i];
            while(i < n -1 && array[i] == array[i+1]) {
                i++;
            }
        }

        return count;
    }
}
